package jmine.tec.web.servlet.delegate;

import java.util.Enumeration;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Provides a convenient implementation of the HttpServletRequest interface that can be subclassed by developers wishing to adapt the
 * request to a Servlet. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request
 * object.
 * 
 * @see javax.servlet.http.HttpServletRequest
 * @since Servlet 2.3
 * @version $Rev: 46019 $ $Date: 2004-09-14 04:56:06 -0500 (Tue, 14 Sep 2004) $
 */
public class HttpServletRequestWrapper extends ServletRequestWrapper implements HttpServletRequest {

    /**
     * @param request {@link HttpServletRequest}
     */
    public HttpServletRequestWrapper(HttpServletRequest request) {
        super(request);
    }

    /**
     * @return {@link HttpServletRequest}
     */
    private HttpServletRequest getHttpServletRequest() {
        return (HttpServletRequest) super.getRequest();
    }

    /**
     * {@inheritDoc}
     */
    public String getAuthType() {
        return this.getHttpServletRequest().getAuthType();
    }

    /**
     * {@inheritDoc}
     */
    public Cookie[] getCookies() {
        return this.getHttpServletRequest().getCookies();
    }

    /**
     * {@inheritDoc}
     */
    public long getDateHeader(String name) {
        return this.getHttpServletRequest().getDateHeader(name);
    }

    /**
     * {@inheritDoc}
     */
    public String getHeader(String name) {
        return this.getHttpServletRequest().getHeader(name);
    }

    /**
     * {@inheritDoc}
     */
    public Enumeration getHeaders(String name) {
        return this.getHttpServletRequest().getHeaders(name);
    }

    /**
     * {@inheritDoc}
     */
    public Enumeration getHeaderNames() {
        return this.getHttpServletRequest().getHeaderNames();
    }

    /**
     * {@inheritDoc}
     */
    public int getIntHeader(String name) {
        return this.getHttpServletRequest().getIntHeader(name);
    }

    /**
     * {@inheritDoc}
     */
    public String getMethod() {
        return this.getHttpServletRequest().getMethod();
    }

    /**
     * {@inheritDoc}
     */
    public String getPathInfo() {
        return this.getHttpServletRequest().getPathInfo();
    }

    /**
     * {@inheritDoc}
     */
    public String getPathTranslated() {
        return this.getHttpServletRequest().getPathTranslated();
    }

    /**
     * {@inheritDoc}
     */
    public String getContextPath() {
        return this.getHttpServletRequest().getContextPath();
    }

    /**
     * {@inheritDoc}
     */
    public String getQueryString() {
        return this.getHttpServletRequest().getQueryString();
    }

    /**
     * {@inheritDoc}
     */
    public String getRemoteUser() {
        return this.getHttpServletRequest().getRemoteUser();
    }

    /**
     * {@inheritDoc}
     */
    public boolean isUserInRole(String role) {
        return this.getHttpServletRequest().isUserInRole(role);
    }

    /**
     * {@inheritDoc}
     */
    public java.security.Principal getUserPrincipal() {
        return this.getHttpServletRequest().getUserPrincipal();
    }

    /**
     * {@inheritDoc}
     */
    public String getRequestedSessionId() {
        return this.getHttpServletRequest().getRequestedSessionId();
    }

    /**
     * {@inheritDoc}
     */
    public String getRequestURI() {
        return this.getHttpServletRequest().getRequestURI();
    }

    /**
     * {@inheritDoc}
     */
    public StringBuffer getRequestURL() {
        return this.getHttpServletRequest().getRequestURL();
    }

    /**
     * {@inheritDoc}
     */
    public String getServletPath() {
        return this.getHttpServletRequest().getServletPath();
    }

    /**
     * {@inheritDoc}
     */
    public HttpSession getSession(boolean create) {
        return this.getHttpServletRequest().getSession(create);
    }

    /**
     * {@inheritDoc}
     */
    public HttpSession getSession() {
        return this.getHttpServletRequest().getSession();
    }

    /**
     * {@inheritDoc}
     */
    public boolean isRequestedSessionIdValid() {
        return this.getHttpServletRequest().isRequestedSessionIdValid();
    }

    /**
     * {@inheritDoc}
     */
    public boolean isRequestedSessionIdFromCookie() {
        return this.getHttpServletRequest().isRequestedSessionIdFromCookie();
    }

    /**
     * {@inheritDoc}
     */
    public boolean isRequestedSessionIdFromURL() {
        return this.getHttpServletRequest().isRequestedSessionIdFromURL();
    }

    /**
     * {@inheritDoc}
     * 
     * @deprecated
     */
    public boolean isRequestedSessionIdFromUrl() {
        return this.getHttpServletRequest().isRequestedSessionIdFromUrl();
    }
}
